package com.lmk.homework;

import java.util.Scanner;

public class work07 {
    public static void main(String[] args) {
   Scanner sc=new Scanner(System.in);
        System.out.println("想看第几个月");
        int b=sc.nextInt();
int i=0;
        int total = 0; //记录兔子总数
        int y = 2; //记录老兔子
        int x1 = 0; //记录满一个月的兔子
        int x2 = 0; //记录满两个月的兔子
        int x3 = 0;  //记录满三个月的兔子

      for(int c=0; c<=b; c++) {
            y += x3; //新的老耗子数量 = 老耗子 + 满三个月的耗子
            x3 = x2;
            x2 = x1;
            x1 = y;
        }

       total = y + x1 + x2 + x3;
        System.out.println(b + "个月后的兔子数量为" + total + "只");
    }
}
